#pragma once

class RendererStorageMgr
{
public:
	RendererStorageMgr();
	~RendererStorageMgr();

	void				InitRendererStorage();
	RBlendState*		CreateBlendState(const std::string& name);
	RRasterizerState*	CreateRasterizerState(const std::string& name);
	RDepthstencilState*	CreateDepthstencilState(const std::string& name);
	RSamplerState*		CreateSamplerState(const std::string& name);
	RConst*				CreateConst(const std::string& name, EConst::Type type, uint size, IConstUpdater* updater, uint arg);
	RMaterial*			CreateMaterial(const std::string& name);
	RTexture*			CreateTexture(const std::string& name);
	RFramebuffer*		CreateFramebuffer(const std::string& name);
	RBuffer*			CreateBuffer(const std::string& name, uint size, bool dynamic, uint type);
	RVertexArray*		CreateVertexArray(const std::string& name);
	RFont*				CreateFont(const std::string& name);

	RBlendState*		GetBlendState(const std::string& name);
	RRasterizerState*	GetRasterizerState(const std::string& name);
	RDepthstencilState* GetDepthstencilState(const std::string& name);
	RSamplerState*		GetSamplerState(const std::string& name);
	RConst*				GetConst(const std::string& name);
	RMaterial*			GetMaterial(const std::string& name);
	RTexture*			GetTexture(const std::string& name);
	RFramebuffer*		GetFramebuffer(const std::string& name);
	RBuffer*			GetBuffer(const std::string& name);
	RVertexArray*		GetVertexArray(const std::string& name);
	RFont*				GetFont(const std::string& name);

private:
	std::map<std::string, RBlendState*>			m_blendStates;
	IMutex*										m_blendStates_mutex;

	std::map<std::string, RRasterizerState*>	m_rasterizerStates;
	IMutex*										m_rasterizerStates_mutex;

	std::map<std::string, RDepthstencilState*>	m_depthstencilStates;
	IMutex*										m_depthstencilStates_mutex;

	std::map<std::string, RSamplerState*>		m_samplerStates;
	IMutex*										m_samplerStates_mutex;

	std::map<std::string, RMaterial*>			m_materials;
	IMutex*										m_materials_mutex;

	std::map<std::string, RConst*>				m_consts;
	IMutex*										m_consts_mutex;

	std::map<std::string, RTexture*>			m_textures;
	IMutex*										m_textures_mutex;

	std::map<std::string, RFramebuffer*>		m_framebuffers;
	IMutex*										m_framebuffers_mutex;

	std::map<std::string, RBuffer*>				m_buffers;
	IMutex*										m_buffers_mutex;

	std::map<std::string, RVertexArray*>		m_vertexarrays;
	IMutex*										m_vertexarrays_mutex;

	std::map<std::string, RFont*>				m_fonts;
	IMutex*										m_fonts_mutex;
};
